package com.yaodian100.ec.activity.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.yaodian100.core.common.entity.BaseEntity;

@Entity
@Table(name = "EC_ACTIVITY_STYLE_GROUP")
public class ActivityStyleGroup extends BaseEntity {
	private static final long serialVersionUID = 5813195980390238900L;
	
	@Id
	@Column(name = "ID")
	private Long id;
	
	@Column(name = "NAME", nullable = false)
	private String name;
	
	@Column(name = "TYPE_NAME", nullable = false)
	private String typeName;
	
	@OneToMany(mappedBy = "styleGroup", targetEntity = ActivityStyle.class)
	@LazyCollection(LazyCollectionOption.FALSE)
	@Cascade( { CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN })
	@OrderBy("id asc")
	@NotFound(action = NotFoundAction.IGNORE)
	private List<ActivityStyle> styles;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<ActivityStyle> getStyles() {
		return styles;
	}

	public void setStyles(List<ActivityStyle> styles) {
		this.styles = styles;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	
	
}
